package com.example.efk.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author 奶茶
 * Created by on 2018/5/24.
 */
public class LogUtil {

    private static Logger logger =null;

    public static void trace(Object obj,String msg,Object...params) {
        if(obj==null){
            logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        }else{
            logger = LoggerFactory.getLogger(obj.getClass());
        }
        logger.trace(String.format("-->> %s",String.format(msg, params)));
    }

    public static void error(Object obj,Throwable e,String msg,Object...params) {
        if(obj==null){
            logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        }else{
            logger = LoggerFactory.getLogger(obj.getClass());
        }
        logger.error(String.format("-->> %s",String.format(msg, params)),e);
    }
}
